package service

import (
	"fmt"
	"gomicro/formJsonMicro/fjmServer/dao"
	"gomicro/formJsonMicro/model"
	"gomicro/webGoMicro/webMessage"
	//"github.com/micro/go-micro/v2/client"
	//"github.com/winterssy/sreq"
	"context"
	"gomicro/formJsonMicro/fjmServer/util"
)

type MemberSriImp struct{
	Dip *dao.MemberDaoImp
}

func (msi *MemberSriImp)InesrtSri(mb []*model.Member)map[string]string{
	var d = dao.MemberDaoImp{}
	msi.Dip = &d
	return msi.Dip.InesrtDao(mb)
}

func (msi *MemberSriImp)QuerySri() []*model.Member{
	var d = dao.MemberDaoImp{}
	msi.Dip = &d

	//returnData := make(map[string]interface{})
	//_ = sreq.Post("http://127.0.0.1:0002/microinsert",
	//	sreq.WithForm(sreq.Values{
	//		"id": "10",
	//		"name": "特朗普",
	//		"birth": "1961-11-09",
	//		"sex": "男",
	//	}),
	//).JSON(&returnData)
	//// if err != nil {
	//// 	panic(err)
	//// }

	//studentClient := webMessage.NewStudentService("student_micro_service", client.DefaultClient)
	var l = webMessage.List{}

	//res, err := studentClient.QueryStudent(context.TODO(), &l)
	res, err := util.Cli.QueryStudent(context.TODO(), &l)
	if err != nil {
		fmt.Println(err)
		return nil
	}

	//returnData
	fmt.Println(res)

	return msi.Dip.QueryDao()
}